package com.drp.dao;

import com.drp.bean.Goods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ren
 * @since 2022-03-16
 */
@Component("goodsMapper")
public interface GoodsMapper extends BaseMapper<Goods> {
    @Insert("insert into t_goods2(g_id,g_name,g_factory,g_price,g_sole,g_number,fk_kindId,fk_supplierId,fk_userId)" +
            "values(#{gId},#{gName},#{gFactory},#{gPrice},#{gSole},#{gNumber},#{fkKindid},#{fkSupplierid},#{fkUserid})")
    int add(Goods goods);
    @Select("select g_id,g_name,g_factory,g_price,g_sole,g_number,fk_kindId,fk_supplierId,fk_userId,fk_clientId from t_goods2")
    List<Goods> getAll();
    @Delete("delete from t_goods2 where g_id = #{id}")
    int deleteById(@Param("id") int id);
    @Insert("insert into t_goods(g_id,g_name,g_factory,g_price,g_sole,g_number,fk_kindId,fk_supplierId,fk_userId)" +
            "values(#{gId},#{gName},#{gFactory},#{gPrice},#{gSole},#{gNumber},#{fkKindid},#{fkSupplierid},#{fkUserid})")
    int addGood(Goods goods);
}
